package com.jzg.jcptadmin.adpter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.jzg.jcptadmin.R;
import com.jzg.jcptadmin.app.AppContext;

import java.util.List;

/**
 * Created by jzg on 2016/1/12.
 */
public class TaskViewStadusAdapter extends BaseAdapter {
    private List<String> staduslist;
    private AppContext appContext;
    public TaskViewStadusAdapter(AppContext appContext,List<String> staduslist){
        this.appContext=appContext;
        this.staduslist = staduslist;
    }
    public void Updata(List<String> staduslist){
        this.staduslist = staduslist;
    }
    @Override
    public int getCount() {
        return staduslist.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = new ViewHolder();
            if(convertView==null){
                convertView =  View.inflate(appContext, R.layout.list_item_popupwindow, null);
               TextView tv_list_item = (TextView) convertView.findViewById(R.id.tv_list_item);
                viewHolder.tv_list_item = tv_list_item;
                convertView.setTag(viewHolder);
            }else{
                viewHolder = (ViewHolder) convertView.getTag();
            }

        viewHolder.tv_list_item.setText(staduslist.get(position));

        return convertView;
    }

    public class ViewHolder{
        private TextView tv_list_item;
    }
}
